use std::collections::HashMap;
use url::Url;

/// 握手信息
///
/// author noear
/// since 2.0
pub trait Handshake {
    /// 协议版本
    fn version(&self) -> String;

    /// 获取传输地址
    ///
    /// return tcp://192.168.0.1/path?user=1&path=2
    fn uri(&self) -> Url;

    /// 请求路径
    fn path(&self) -> String;

    /// 获取参数集合
    fn param_map(&self) -> HashMap<String, String>;

    /// 获取参数
    ///
    /// param name 参数名
    fn param(&self, name: &str) -> Option<String>;

    /// 获取参数或默认值
    ///
    /// param name 参数名
    /// param def 默认值
    fn param_or_default(&self, name: &str, def: &str) -> String;

    /// 放置参数
    fn param_put(&mut self, name: &str, value: &str);

    /// 输出元信息
    fn out_meta(&self, name: &str, value: &str);
}